<?php

//This is the file called by cron to see if any processing remains by checking for existence of a queue
//This should be run after the longest time that the whole process would complete, 
//but before the simplepie cache expires

	
include_once (dirname(dirname(dirname(dirname(__FILE__)))) .  DIRECTORY_SEPARATOR."wp-load.php");

$proc_q = array();
$proc_q = get_option('mct_ai_proc_queue');
if (empty($proc_q)) {
    exit();
}
include_once('tgtai_process.php');
define (MCT_AI_LOG_PROCESS,'PROCESS');
//previous process didn't finish, so lets try again
mct_ai_log('Blog',MCT_AI_LOG_PROCESS, 'Restart Processing', '');
$url = plugins_url().'/TargetAI/tgtai_process_page.php';
	
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);  //Set timeout to 1ms so we return and let it run

curl_exec($ch);
curl_close($ch);
exit();
?>